package com.zy.springboot.entity.book;

import com.alibaba.fastjson.JSONObject;
import com.zy.springboot.entity.BaseEntity;

import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * Created by y on 2019/1/11.
 */
@Entity
@Table(name = "T_SYS_BOOK", schema = "booksearch", catalog = "")
public class BookEntity extends BaseEntity implements Serializable {

    private String bookName;
    private String author;
    private String imgUrl;//
    private String introduce;//
    private String grade;//
    private String downloadUrl;//

    public String getBookName() {
        return bookName;
    }

    public void setBookName(String bookName) {
        this.bookName = bookName;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getImgUrl() {
        return imgUrl;
    }

    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }

    public String getIntroduce() {
        return introduce;
    }

    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }

    public String getGrade() {
        return grade;
    }

    public void setGrade(String grade) {
        this.grade = grade;
    }

    public String getDownloadUrl() {
        return downloadUrl;
    }

    public void setDownloadUrl(String downloadUrl) {
        this.downloadUrl = downloadUrl;
    }

    @Override
    public JSONObject getJSONObject() {
        JSONObject obj = new JSONObject();
        obj.put("ID", this.getId());
        obj.put("BOOKNAME", this.getBookName());
        obj.put("AUTHOR", this.getAuthor());
        obj.put("IMGURL",this.getImgUrl());
        obj.put("INTRODUCE",this.getIntroduce());
        obj.put("GRADE",this.getGrade());
        obj.put("CREATE_TIME",this.getCreateTime());
        obj.put("UPDATE_TIME", this.getUpdateTime());
        obj.put("DEL_FLAG",this.getDelFlag());
        obj.put("DOWNLOADURL",this.getDownloadUrl());
        return obj;
    }

    @Override
    public String getTableName() {
        return "T_SYS_BOOK";
    }

    @Override
    public JSONObject getJSONColumns() {
        JSONObject obj = new JSONObject();
        obj.put("ID", "id");
        obj.put("BOOKNAME", "bookName");
        obj.put("AUTHOR", "author");
        obj.put("IMGURL","imgUrl");
        obj.put("INTRODUCE","introduce");
        obj.put("GRADE","grade");
        obj.put("CREATE_TIME", "createTime");
        obj.put("UPDATE_TIME", "updateTime");
        obj.put("DEL_FLAG","delFlag");
        obj.put("DOWNLOADURL","downloadUrl");
        return obj;
    }

}

